﻿
#region Usings
using System;

using PolyGameEngine.Tools;


using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Content;

#endregion

namespace PolyGameEngine.MenuSystem
{
    public class About
    {
        GameState gameState
        {
            get { return PhysicsGame.gamestate; }
            set { PhysicsGame.ChangeGameState(value); }
        }
        ContentManager content;
        Viewport viewport;
        String[] info = new String[5];
        Texture2D background;
        Texture2D oshadow;
        SpriteFont font;
        Color[] colors = new Color[2];
        float K = 0.9f;
        int colornumber;
        bool grow = true;
        int counter = 0;

        public About(ContentManager Content, Viewport Viewport, SpriteFont Font)
        {
            content = Content;
            viewport = Viewport;
            font = Font;
            colors[0] = Color.Black;
            colors[1] = Color.Maroon;
            info[0] = "Jano Naude            22144315";
            info[1] = "Dawie de Villiers     21189064";
            info[2] = "Stefan Bergh          22251502";
            info[3] = "Petrie van Zyl        22290680";
            info[4] = "Juan Luies            21697434";
            background = content.Load<Texture2D>("Menu/plastic");
            oshadow = content.Load<Texture2D>("Menu/OuterShadow");

        }



        public void draw(SpriteBatch sb)
        {

            sb.Draw(background, new Rectangle(0, 0, background.Width, background.Height), Color.White);
            sb.Draw(oshadow, new Rectangle(0, 0, oshadow.Width, oshadow.Height), Color.White);
            Vector2 initialC = new Vector2((int)(viewport.Width * 0.1), (int)(viewport.Height * 0.1));

            if (counter >= info.Length)
                counter = info.Length - 1;

            for (int i = 0; i <= counter; i++)
            {
                sb.DrawString(font, info[i], initialC, colors[colornumber], 0, Vector2.Zero, K, SpriteEffects.None, 0);
                initialC.Y += 100;
                initialC.X += 5;
            }

            initialC.Y = viewport.Height;


        }

       


        public void update()
        {
            InputMan.Update();
            if (InputMan.OnPress(Keys.Escape))
            {
                AudioMan.PlayCue("Trampoline");
                gameState = GameState.Menu;
            }

            if (K >= 1f)
            {
                colornumber = 0;
                grow = false;
                counter++;
            }
            if (K <= 0.89f)
            {
                colornumber = 1;
                grow = true;
                counter++;
            }
            if (grow)
                K += 0.002F;
            else
                K -= 0.002f;
        }



    }
}
